package com.li.test.model3;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/producer")
@Slf4j
public class Model3Controller {
    @Autowired
    RabbitTemplate rabbitTemplate;
    @RequestMapping("/simpleQueue")
    public ResponseEntity simpleQueue(String message){
        log.info("生产者发送消息：{}"+message);
        rabbitTemplate.convertAndSend("simple.queue",message);
        return ResponseEntity.ok("消息发送成功");
    }
}

